import { loadesFiles } from '@/utils'
import ComLayout from '@/layout/ComponentLayout.vue'

import useMegerRouter from '../../guard/useMergeRouter'
import { appConfig } from '@/config'

const megerRouter = new useMegerRouter(appConfig)

export const dynamicRoutes = megerRouter.setMergeRoutes([
  {
    path: '/system',
    name: 'System',
    meta: {
      title: '系统设置',
      icon: 'icon-xitongshezhi'
    },
    redirect: {
      name: 'Role'
    },
    component: ComLayout,
    children: loadesFiles(import.meta.glob('./system/*.ts', { eager: true }))
  },
  {
    path: '/component',
    name: 'Component',
    meta: {
      title: '组件',
      icon: 'icon-zujian'
    },
    redirect: {
      name: 'CESelect'
    },
    component: ComLayout,
    children: loadesFiles(import.meta.glob('./component/*.ts', { eager: true }))
  }
])
